package net.alteiar.images.metadata;

import java.awt.Point;
import java.util.Observable;

public class EntityInfo extends Observable {
	private Point position;
	private int width;
	private int height;

	public EntityInfo(Point center, int width, int height) {
		this.position = center;
		this.width = width;
		this.height = height;
	}

	public Point getCenter() {
		Point p = getPosition();
		p.x = p.x + width / 2;
		p.y = p.y + height / 2;
		return p;
	}

	/**
	 * 
	 * @return the position of the upper left corner
	 */
	public Point getPosition() {
		return (Point) position.clone();
	}

	public void setCenter(Point center) {
		this.position = center;
		this.setChanged();
		this.notifyObservers();
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
		this.setChanged();
		this.notifyObservers();
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
		this.setChanged();
		this.notifyObservers();
	}
}
